package com.bwei.topnews.app;

import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Process;

import com.bwei.topnews.utils.ImageLoaderUtils;
import com.bwei.topnews.utils.ImageLoader_SlidingMenu;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

import org.xutils.x;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import cn.smssdk.SMSSDK;

/**
 * Created by qwe on 2016/10/31.
 */
public class MyApplication extends Application {

    private static Context context;
    private static Handler handler;
    private static int mymainId;
    private static Thread currentThread;
    private static ExecutorService executorService;
    public static boolean channelLongClick=false;

    @Override
    public void onCreate() {
        super.onCreate();
        // 得到上下文
        context = getApplicationContext();
        // 得到Handler
        handler = new Handler();
        // 得到当前线程ID
        mymainId =  Process.myTid();
        // 得到当前线程
        currentThread = Thread.currentThread();
        // 得到线程池
        executorService = Executors.newFixedThreadPool(5);
        // 初始化xutils
        x.Ext.init(this);
        x.Ext.setDebug(true);
        ImageLoaderUtils.initConfiguration(context);
        ImageLoader_SlidingMenu.getImage(context);
        PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
        UMShareAPI.get(this);

        //短信初始化

        SMSSDK.initSDK(this, "18d3ae77ab16c", "ceb8cb7d9eb397fc2609f7ec493cbe2d");

    }
    public static Context getContext(){
        return context;
    }
    public static Handler getHandler(){
        return handler;
    }
    public static int getMyTid(){
        return mymainId;
    }
    public static Thread getMainThread(){
        return currentThread;
    }
    public static ExecutorService getThreadPool(){
        return executorService;
    }
}
